import requests
from collections import Counter


url = 'https://match.yuanrenxue.cn/api/match/3?page=%s'
headers = {
    'Host': 'match.yuanrenxue.cn',
    'Connection': 'keep-alive',
    'Content-Length': '0',
    'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
    'sec-ch-ua-mobile': '?0',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
    'sec-ch-ua-platform': '"Windows"',
    'Accept': '*/*',
    'Origin': 'https://match.yuanrenxue.cn',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': 'https://match.yuanrenxue.cn/match/3',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cookie': 'qpfccr=true; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1691667283,1691672620,1691828168,1692098903; sessionid=4me5sb4xuse1rnsfqsdyugg52v1mjnt6; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1691811476,1691844198,1692098705,1692101490; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1692101490; no-alert3=true',
}


session = requests.session()
session.headers = headers
lst = []
for i in range(1, 6):
    session.post('https://match.yuanrenxue.cn/jssm')
    response = session.get(url%i)
    json_data = response.json()
    for dic in json_data.get('data'):
        lst.append(dic.get('value'))

print(lst)
count = dict(Counter(lst))
max_value = sorted(count.items(), key=lambda a: a[-1])[-1][0]
print(max_value)